#include "log.h"
#include "APP_Buffer.h"

int main(int argc, char const *argv[])
{
    // //初始化获取环形缓冲区 大小为10个
    // Buffer* buff = APP_Buffer_Init(10);
    // char data[15] = {0};
    // //读取6个数据 结果: 　　　　　　当前数据为空
    // APP_Buffer_Read(buff,data,5);
    // //写入 "ABCDE"  结果:"ABCDE"
    // APP_Buffer_Write(buff,"ABCDE",5);
    // //写入 "FGHIJ"  结果:"ABCDEFGHIJ"
    // APP_Buffer_Write(buff,"FGHIJ",5);
    // //写入 "01234"  结果:"ABCDEFGHIJ" **  满了写不下了
    // APP_Buffer_Write(buff,"01234",5);
    // //读取  7个数据  结果:"ABCDEFG"
    // APP_Buffer_Read(buff,data,7);
    // //写入 “7654321” 结果:"7654321HIJ"
    // APP_Buffer_Write(buff,"7654321",7);
    // //读取  5个数据   结果:"HIJ76"  **
    // memset(data,0,sizeof(data));
    // APP_Buffer_Read(buff,data,5);
    // return 0;

    //初始化获取环形缓冲区 大小为10个
    Buffer* buff = APP_Buffer_Init(10);
    char data[15] = {0};
    //写入 "ABCDEFGHIJ"  结果:"ABCDEFGHIJ"
    APP_Buffer_Write(buff,"ABCDEFGHIJ",10);
    //读取  7个数据  结果:"ABCDEFG"
    APP_Buffer_Read(buff,data,7);
    //写入 “76” 结果:"HIJ76"
    APP_Buffer_Write(buff,"76",2);
    //写入 “54321” 结果:"HIJ7654321"
    APP_Buffer_Write(buff,"54321",5);  
    //读取  5个数据   结果:"HIJ76"  **
    memset(data,0,sizeof(data));
    APP_Buffer_Read(buff,data,5);
    return 0;
}
